class Result {
  constructor (data, media_type, frame_type, time, errorCode, 
    duration = 20, type = -1) {
    this.data = data;
    this.media_type = media_type;
    this.frame_type = frame_type;
    this.type = type;
    this.time = time;
    this.duration = duration;
    this.errorCode = errorCode;
  }

  static makeErrorResult (errorCode) {
    return new Result(null, -1, -1, -1, errorCode);
  }
}

Result.ErrorCode = class {
  constructor () {

  }
}


Result.ErrorCode.SUCCESS = 0;
Result.ErrorCode.PARAM_ERROR = 1000;
Result.ErrorCode.PARAM_ERROR_SPS_BEGIN = 1001;
Result.ErrorCode.PARAM_ERROR_SPS_END = 1002;
Result.ErrorCode.PARAM_ERROR_PPS_BEGIN = 1003;
Result.ErrorCode.PARAM_ERROR_PPS_END = 1004;
Result.ErrorCode.PARAM_ERROR_SPS_PARSE = 1005;
Result.ErrorCode.PARAM_ERROR_SIZE = 1006;
Result.ErrorCode.PARAM_ERROR_LENGTH = 1007;
Result.ErrorCode.PARAM_CHANGE = 2000;
Result.ErrorCode.FAIL = 3000;
Result.ErrorCode.NO_INIT_ERROR = Result.ErrorCode.FAIL + 1;
Result.ErrorCode.CACHE_MAX_ERROR = Result.ErrorCode.FAIL + 2;

Result.Type = class {
  constructor () {

  }
}

Result.Type.FMP4_HEAD = 5;
Result.Type.FMP4_BODY = 6;
Result.Type.RTP_PACKAGE_COMPLETE = 0;
Result.Type.RTP_PACKAGE_HEAD = 1;
Result.Type.RTP_PACKAGE_TAIL = 2;
Result.Type.RTP_PACKAGE_BODY = 3;
// Result.Type.H264_I_FRAME = 0;
// Result.Type.H264_P_FRAME = 1;
// Result.Type.H264_B_FRAME = 2;
// Result.Type.AUDIO = 3;
// Result.Type.TRANS_DATA = 4;


Result.MediaType = class {
  constructor () {

  }
}

Result.MediaType.H264 = 0;
Result.MediaType.AAC = 1;
Result.MediaType.G711A = 2;
Result.MediaType.MPEG4 = 3;
Result.MediaType.H265 = 4;
Result.MediaType.G711U = 5;




Result.FrameType = class {
  constructor () {
    
  }
}

Result.FrameType.KEY = 0;
Result.FrameType.NOTKEY = 1;
